<template>
  <div id="index">
    <el-container>
      <el-main>
        <el-input placeholder="请输入内容" v-model="input" class="searchClass">
          <el-button slot="append" icon="el-icon-search" @click="jump"></el-button>
        </el-input>
      </el-main>
    </el-container>
  </div>
</template>
<script>
  import axios from "axios";
  export default {
    data() {
      return {
        input: "",
        select: "",
        test: "",
        // searchData: [],
      };
    },
    components: {},
    methods: {
      jump() {
        var that = this;
        if (!that.input) {
          that.$message.warning("请输入搜索内容!");
          return false;
        } else {
          axios
            .get("http://127.0.0.1:5000/getMsg?searchinfo=" + that.input)
            .then((response) => {
              // alert(response.data[0]);
              // debugger
              // that.searchData = response.data;
              // console.log("searchData:", that.searchData);
              console.log("response.data:", response.data);
              this.$router.push({
                path: "/list",
                query: { searchData: response.data, searchInfo: that.input },
              });
            });
        }
      },
    },
  };
</script>

<style>
  html{
    height: 100%;
  }

  body {
    margin: 0px;
    padding: 0px;
    height: 100%;
  }

  #index {
    background: url(../../assets/bgc.png) no-repeat ;
    background-size: 100% 100%;
    background-attachment:fixed;
  }

  .el-main {
    /* background-color: #E9EEF3; */
    color: #333;
    text-align: center;
    line-height: 920px;
  }

  .searchClass {
    border: 1px solid #c5c5c5;
    border-radius: 20px;

    background: #f4f4f4;
    width: 60%;
  }

  .searchClass .el-input-group__prepend {
    border: none;
    background-color: transparent;
    padding: 0 10px 0 30px;
  }

  .searchClass .el-input-group__append {
    border: none;
    background-color: transparent;
  }

  .searchClass .el-input__inner {
    height: 50px;
    line-height: 50px;
    border: none;
    background-color: transparent;
  }

  .searchClass .el-icon-search {
    font-size: 16px;
  }

  .searchClass .centerClass {
    height: 100%;
    line-height: 100%;
    display: inline-block;
    vertical-align: middle;
    text-align: right;
  }

  .searchClass .line {
    width: 1px;
    height: 26px;
    background-color: #c5c5c5;
    margin-left: 14px;
  }

  .searchClass:hover {
    border: 1px solid #D5E3E8;
    background: #fff;
  }

  .searchClass:hover .line {
    background-color: #D5E3E8;
  }

  .searchClass:hover .el-icon-search {
    color: #409eff;
    font-size: 16px;
  }
</style>